﻿@{
    ViewBag.Title = "category";
    Layout = "~/Views/Shared/Houyun.cshtml";
}
@{
    List<LeEdu.MODEL.Columnss> collist = ViewBag.collist;
}


<div class="page-header clearfix">
    <h1 class="pull-left">栏目管理</h1>
    <div class="pull-right">
        <button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#Addcategory">新建栏目</button>
    </div>
</div>

@*添加模态框*@

<div class="modal fade" id="Addcategory" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <form class="form-horizontal" method="post" action="/Group/Addcategory">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="exampleModalLabel">添加栏目</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">栏目名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="CLNAME" id="CLNAME" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">栏目编码</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="CLCODING" id="CLCODING" placeholder="">
                            <span style="color:#808080">生成列表，资讯时使用，例如news bbs等</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">父栏目</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="CLMGR">
                                <option value="0">选择栏目</option>
                                @foreach (var item in collist)
                                {
                                    <option value="@item.ColumnssID">@item.CLNAME</option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">显示顺序号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="CLOrder" id="CLOrder" placeholder="0">
                            <span style="color:#808080">显示顺序号 数字越小 位置越前</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">SEO标题</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="CLSEOtitle" id="CLSEOtitle" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">SEO关键字</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="CLSEOKey" id="CLSEOKey" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">SEO描述</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="CLSEOdescribe" id="CLSEOdescribe" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="text" class="col-sm-2 control-label">启用</label>
                        <div class="col-sm-10">
                            <label class="radio-inline">
                                <input type="radio" name="CLState" id="radio1" value="1" ><span>是</span>
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="CLState" id="radio2" value="0" checked="checked"><span>否</span>
                            </label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>

<ul class="nav nav-tabs mbm">
    <li>
        <a href="/Group/GroupIndex">资讯管理</a>
    </li>
    <li class="active">
        <a href="/Group/category">栏目管理</a>
    </li>
</ul>

<table class="table table-hover" id="category-table">
    <thead>
        <tr>
            <th width="40%">栏目名称</th>
            <th width="20%">编码</th>
            <th width="10%">显示序号</th>
            <th width="10">状态</th>
            <th width="20%">操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in collist)
        {
            <tr>
                <td>
                    <a href="/Group/GroupIA/@item.ColumnssID">
                        @item.CLNAME
                    </a>
                </td>
                <td>@item.CLCODING</td>
                <td>@item.CLOrder</td>
                <td>@(Convert.ToInt32(item.CLState)==0?"关闭":"开启")</td>
                <td>
                    <a href="/Group/EditGroup/@item.ColumnssID" class="btn btn-default btn-sm" data-target="#GrouprEdit" data-toggle="modal"><i class="glyphicon glyphicon-edit"></i>编辑</a>
                    <a href="/Group/AddColumn/@item.ColumnssID" class="btn btn-default btn-sm" data-target="#AddCol" data-toggle="modal"><i class="glyphicon glyphicon-plus"></i>添加子栏目</a>
                </td>
            </tr>

        }


    </tbody>
</table>
@*编辑栏目*@

<div class="modal fade" id="GrouprEdit" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
        </div><!-- /.modal-content -->
    </div>
</div>
<script>
    $("#GrouprEdit").on("hidden.bs.modal", function () {
        $(this).removeData("bs.modal");
    })
</script>

@*添加子栏目*@
<div class="modal fade" id="AddCol" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
        </div><!-- /.modal-content -->
    </div>
</div>
<script>
    $("#AddCol").on("hidden.bs.modal", function () {
        $(this).removeData("bs.modal");
    })
</script>